function Dropdown(param) {

	var that = this;
	
	this.j_dropdown_link = null;
	this.j_dropdown = null;
	
	function __construct(p) {
		for(pkey in p) {
			if(pkey[0] != "_") {
				that[pkey] = p[pkey];
			}
		}
		
		that.j_dropdown_link.click(dropdownLinkClick);
		that.j_dropdown.click(dropdownClick);
		
	}
	
	function dropdownLinkClick(e) {
	try{
		e.preventDefault();
		if(!jq(this).hasClass("active")) {
			hideActiveEl();
		}
		jq(this).toggleClass("active");
		var data_dropdown = jq(this).data("dropdown");
		var align = data_dropdown.align;
		var related_dropdown = jq(this).parent().find("[data-dom-id=dropdown]");
		if(align === "left") {
			related_dropdown.css({ "left" : "0" });
		}else {
			related_dropdown.css({ "right" : "0" });
		}
		related_dropdown.toggleClass("active");
	}catch(err) {
		alert(err);
	}
	}
	
	function dropdownClick(e) {
	try{
	    e.stopPropagation();
	}catch(err) {
		alert(err);
	}
	}
	
	jq("html").click(function(e) {
	try{
		var target = jq(e.target);
		if(!(target.is('a[href="#dropdown_link"]') || target.is('a[href="#dropdown_link"] .arrow-down') || target.is('a[href="#dropdown_link"] img'))) {
        	
			// hide active dropdowns
   			if(that.j_dropdown_link.hasClass("active")) {
				that.j_dropdown_link.removeClass("active");
   			}
			if(that.j_dropdown.hasClass("active")) {
				that.j_dropdown.removeClass("active");
			}
		}
	}catch(err) {
		alert(err);
	}
	});
	
	function hideActiveEl() {
	try{
		jq('a[href="#dropdown_link"].active').removeClass("active");
		jq("[data-dom-id=dropdown].active").removeClass("active");
	}catch(err) {
		alert(err);
	}
	}

	__construct(param);
	
}
